package cn.gogpay.dcb.api.service;

import cn.gogpay.dcb.api.dao.GoodsItemRepository;
import cn.gogpay.dcb.api.entity.GoodsItem;
import cn.gogpay.dcb.common.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 可充值列表
 *
 * @author jiaoming@gogpay.cn
 * @date 2019/12/2 22:58
 */
@Service
public class GoodsItemService extends BaseService<GoodsItem,String> {

    @Autowired
    private GoodsItemRepository goodsItemRepository;

    /**
     * 获取可充值价格列表
     *
     * @return
     */
    public List<GoodsItem> getAll() {
        GoodsItem goodsItem = new GoodsItem();
        goodsItem.setDelFlag(false);

        Example<GoodsItem> example = Example.of(goodsItem);

        List<GoodsItem> list = this.goodsItemRepository.findAll(example);

        return list;
    }

    @Override
    protected JpaRepository<GoodsItem, String> getBaseRepository() {
        return goodsItemRepository;
    }
}
